/**
 * Blog elements
 * @author ReGeDa
 */
(function() {

	function UITopButton(id) {

		var e = $(id).css("visibility","visible");

		return e;
	}

	var topButtons = {};

	var jWindow = $(window);

	/**
	 * On window resize event
	 */
	var onResize = function() {

		var w = $.windowsize();

		var w2 = w[0] >> 1;
		var h2 = w[1] >> 1;

		topButtons.console.animate(
			"bounce:left[" + (w2 - (topButtons.console.width() >> 1)) + "]&out",
			"xopacity[0;100]"
		);

		topButtons.share.animate(
			"left[" + (w2 - (topButtons.share.width() >> 1)) + "]500",
			"bounce:top[" + (w[1] - topButtons.share.height()) + "]800&inOut",
			"xopacity[0;100]"
		);

		topButtons.post.animate(
			"left[" + (w[0] - topButtons.post.width()) + "]",
			"top[" + (h2 - (topButtons.post.height() >> 1)) + "]",
			"xopacity[0;100]"
		);

		topButtons.search.animate(
			"top[" + (h2 - (topButtons.search.height() >> 1)) + "]",
			"xopacity[0;100]"
		);
	};

	// Run Once "OnLoad"
	jWindow.bind("load", function() {
		// initialize UI controls
		["console","share","post","search"].each(function(id) {
			topButtons[id] = new UITopButton(id + "-ctrl");
		});

		onResize();
	});

	// global "OnLoad" & "OnResize"
	jWindow.bind("resize", onResize);

})();
// end of file